Package edu.uky.ai.lp.logic
Class BooleanExpression
java.lang.Object
edu.uky.ai.lp.logic.BooleanExpression
- All Implemented Interfaces:
Expression,Formula
- Direct Known Subclasses:
NAryBooleanExpression,Negation
public abstract class BooleanExpression extends java.lang.Object implements Expression
The superclass of all Boolean logical expressions.
- Author:
- Stephen G. Ware
-
Field Summary
Fields Modifier and Type Field Description protected Expression[]argumentsThe arguments to which the operator appliesjava.lang.StringoperatorThe name of the logical operator -
Constructor Summary
Constructors Constructor Description BooleanExpression(java.lang.String operator, Expression[] arguments)Constructs a new Boolean expression with the given operator and arguments. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object other)inthashCode()protected Expression[]substituteArguments(Unifier unifier)Returns the expression's arguments with their variables substituted.protected java.lang.StringtoString(java.lang.String separator)Given a separator character, this method returns a string representation of this expression with its argument separated.Unifierunify(Formula other, Unifier unifier)Unify this formula with another formula, adding to a given unifier as needed to make the two expression the same.
-
Field Details
-
Constructor Details
-
BooleanExpression
Constructs a new Boolean expression with the given operator and arguments.- Parameters:
operator- the Boolean operator to be usedarguments- the argument to which the operator applies
-
-
Method Details
-
equals
public boolean equals(java.lang.Object other)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
protected java.lang.String toString(java.lang.String separator)Given a separator character, this method returns a string representation of this expression with its argument separated.- Parameters:
separator- the separator character- Returns:
- a string
-
unify
Description copied from interface:FormulaUnify this formula with another formula, adding to a given unifier as needed to make the two expression the same. The unifier passed in as an argument will not be modified; the (possibly extended) unifier is be returned by this method. -
substituteArguments
Returns the expression's arguments with their variables substituted.- Parameters:
unifier- the unifier- Returns:
- this expression's arguments, with variables substituted
-